package com.dfbz.设计模式.singleton;

import org.junit.Test;

public class Demo01 {

    @Test
    public void test1(){

//        Singleton s1 = Singleton.singleton;
//        Singleton s2 = Singleton.singleton;
//        Singleton s3 = Singleton.singleton;

/*        Singleton s1 = Singleton.getSingleton();
        Singleton s2 = Singleton.getSingleton();
        Singleton s3= Singleton.getSingleton();

        System.out.println(s1==s2);
        System.out.println(s3==s2);*/

        for (int i = 0; i < 1000; i++) {
            new Thread(){
                @Override
                public void run() {

                    Singleton.getSingleton();
                }
            }.start();
        }

    }
}
